#pragma once

#define REGISTERBEHAVIOR(behavior, func) static bool ___init = Game::RegisterBehavior(#behavior, behavior::func)

#include <map>
#include "HashedString.h"
#include "IEvent.h"
#include "TinyXML2.h"

class EntityController;

class IBehavior
{
public:
	typedef Pointer<IBehavior> (*CreateFunction)( EntityController* );
	typedef std::map<HashedString, CreateFunction> CreatorMap_t;
	typedef std::pair<HashedString, CreateFunction> CreatorPair_t;

	virtual const HashedString& Type() const = 0;
	IBehavior( EntityController* controller );

	virtual void Update() = 0;
	virtual bool ToXML( tinyxml2::XMLPrinter& printer ) = 0;
	virtual bool FromXML( tinyxml2::XMLElement* element ) = 0;
protected:
	EntityController* m_controller;
};